package tech.mlsql.api.jdbc

import java.sql.{Blob, CallableStatement, Clob, Connection, DatabaseMetaData, NClob, PreparedStatement, SQLWarning, SQLXML, Savepoint, Statement, Struct}
import java.util.Properties
import java.util.concurrent.Executor
import java.{sql, util}

import tech.mlsql.api.jdbc.metadata.MLSQLDatabaseMetaData
import tech.mlsql.api.jdbc.statement.MLSQLPreparedStatement

/**
 * 11/6/2020 WilliamZhu(allwefantasy@gmail.com)
 */
class MLSQLConnection(val props: Map[String, String]) extends Connection {

  private var _isClosed = false
  private var _autoCommit = true

  override def createStatement(): Statement = ???

  override def prepareStatement(sql: String): PreparedStatement = {
    val ps = new MLSQLPreparedStatement(sql, this)
    ps
  }

  override def prepareCall(sql: String): CallableStatement = ???

  override def nativeSQL(sql: String): String = ???

  override def setAutoCommit(autoCommit: Boolean): Unit = ???

  override def getAutoCommit: Boolean = ???

  override def commit(): Unit = ???

  override def rollback(): Unit = ???

  override def close(): Unit = {
    _isClosed = true
  }

  override def isClosed: Boolean = _isClosed

  override def getMetaData: DatabaseMetaData = {
    new MLSQLDatabaseMetaData(props(MLSQLConst.PROP_USER), "")
  }

  override def setReadOnly(readOnly: Boolean): Unit = ???

  override def isReadOnly: Boolean = ???

  override def setCatalog(catalog: String): Unit = ???

  override def getCatalog: String = ???

  override def setTransactionIsolation(level: Int): Unit = ???

  override def getTransactionIsolation: Int = ???

  override def getWarnings: SQLWarning = ???

  override def clearWarnings(): Unit = ???

  override def createStatement(resultSetType: Int, resultSetConcurrency: Int): Statement = ???

  override def prepareStatement(sql: String, resultSetType: Int, resultSetConcurrency: Int): PreparedStatement = ???

  override def prepareCall(sql: String, resultSetType: Int, resultSetConcurrency: Int): CallableStatement = ???

  override def getTypeMap: (java.util.Map[String, Class[_]]) = ???

  override def setTypeMap(map: (java.util.Map[String, Class[_]]) ): Unit = ???

  override def setHoldability(holdability: Int): Unit = ???

  override def getHoldability: Int = ???

  override def setSavepoint(): Savepoint = ???

  override def setSavepoint(name: String): Savepoint = ???

  override def rollback(savepoint: Savepoint): Unit = ???

  override def releaseSavepoint(savepoint: Savepoint): Unit = ???

  override def createStatement(resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): Statement = ???

  override def prepareStatement(sql: String, resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): PreparedStatement = ???

  override def prepareCall(sql: String, resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): CallableStatement = ???

  override def prepareStatement(sql: String, autoGeneratedKeys: Int): PreparedStatement = ???

  override def prepareStatement(sql: String, columnIndexes: Array[Int]): PreparedStatement = ???

  override def prepareStatement(sql: String, columnNames: Array[String]): PreparedStatement = ???

  override def createClob(): Clob = ???

  override def createBlob(): Blob = ???

  override def createNClob(): NClob = ???

  override def createSQLXML(): SQLXML = ???

  override def isValid(timeout: Int): Boolean = ???

  override def setClientInfo(name: String, value: String): Unit = ???

  override def setClientInfo(properties: Properties): Unit = ???

  override def getClientInfo(name: String): String = ???

  override def getClientInfo: Properties = ???

  override def createArrayOf(typeName: String, elements: Array[AnyRef]): sql.Array = ???

  override def createStruct(typeName: String, attributes: Array[AnyRef]): Struct = ???

  override def setSchema(schema: String): Unit = ???

  override def getSchema: String = ???

  override def abort(executor: Executor): Unit = ???

  override def setNetworkTimeout(executor: Executor, milliseconds: Int): Unit = ???

  override def getNetworkTimeout: Int = ???

  override def unwrap[T](iface: Class[T]): T = ???

  override def isWrapperFor(iface: Class[_]): Boolean = ???
}
